<?php
/**
 * FileName: BasicModel.php
 * Author: 790213952@qq.com
 * DateTime: 2024/8/9 上午11:42
 * SystemName: ym-admin
 *
 */


namespace YmPhp\Admin\Models;

use YmPhp\Admin\Repositories\ResponseCode;
use YmPhp\Admin\Services\DataServices;
use Illuminate\Database\Eloquent\Model;
use Jiannei\Response\Laravel\Support\Facades\Response;


/**
 * App\Models\BasicModel
 *
 * @method static \Illuminate\Database\Eloquent\Builder|BasicModel newModelQuery()
 * @method static \Illuminate\Database\Eloquent\Builder|BasicModel newQuery()
 * @method static \Illuminate\Database\Eloquent\Builder|BasicModel query()
 * @mixin \Eloquent
 */
class BasicModel extends Model
{

    protected $guarded = [];

    /**
     * 为 array / JSON 序列化准备日期格式
     *
     * @param \DateTimeInterface $date
     * @return string
     */
    protected function serializeDate(\DateTimeInterface $date)
    {
        return $date->format('Y-m-d H:i:s');
    }
    /**
     * 格式化数字
     */
    public function float_number($number){
        $length = strlen($number);  //获取数字长度
        if($length >4){
            return floor($number * 0.001) * 0.1."w";
        }else{
            return $number;
        }
    }

}
